#include "../globals/globals.h"
#include "auto_lib.h"

void fast_turn(double aim, double pf, double pt_abs, int timeout) {
  int dir = 1;
  if (get_gyro() > aim)
    dir = -1;
  chassis.FT_set_voltage(pf, dir * pt_abs);
  timer t;
  while (t.time() < timeout && abs(aim - get_gyro()) > 2)
    wait(1);
  chassis.FT_set_voltage(-sgn(pf) * 5, -dir * 10);
  wait(100);
  chassis.stop();
}